package com.ys.ffms.controller;

import com.ys.ffms.common.Result;
import com.ys.ffms.pojo.UserLogin;
import com.ys.ffms.pojo.VO.UserLoginVO;
import com.ys.ffms.service.UserLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @Description: UserLoginController控制台
 * @PROJECT_NAME: ffmsService
 * @DESCRIPTION:
 * @USER: lin
 * @DATE: 2022/1/31 13:55
 */
@RestController
@RequestMapping("/UserLogin")
public class UserLoginController {

    @Autowired
    private UserLoginService userLoginService;


    @RequestMapping("/insertLoginData")
    public Result<?> insertLoginData(@RequestBody UserLogin userLogin){
        userLogin.setLoginTime(new Date());//设置登录时间
        int r = userLoginService.insertDate(userLogin);
        System.err.println(r);
        return Result.success(userLogin,"插入成功!");
    }

    @PostMapping("/findTimeLine")
    public Result<?> findTimeLine(){
        List<UserLoginVO> list = userLoginService.findTimeLine();
        return Result.success(list,"查询成功!");
    }
}
